// 创建store,需要的工具
import {
  legacy_createStore as createStore,
  combineReducers,
  applyMiddleware,
} from 'redux';
// thunk 中间件
import thunk from 'redux-thunk';
// 数据查看插件
import { composeWithDevTools } from 'redux-devtools-extension';

// 导入模块（业务）reducer
import { login } from './reducers/login';
// 导入用户模块
import { user } from './reducers/user';
// 导入首页文章相关模块
import { home } from './reducers/home';
// 导入文章详情模块
import { article } from './reducers/article';
// rootReducer
const rootReducer = combineReducers({ login, user, home, article });

// 导出创建的store
export const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
);
